var  standardNum=0,
noStandardNum=0,
noData=0;
function resetVal(){
     standardNum=0;
     noStandardNum=0,
     noData=0;
}
function visceralFatJudge(val,levelVal){ //内脏脂肪判断
        let level="";
        let standard=false;
        let empty=false;
        val=Math.round(val);
        if(val==0){
            empty=true;
            noData++;
            return {level,empty}
        }
        if(val>=levelVal[3].startValue){
            level="超高"
            standard=false;
            noStandardNum++;
            return {level,standard};
        }else if(val>=levelVal[2].startValue){
            level="较高"
            standard=false;
            noStandardNum++
            return {level,standard};
        }else if(val>=levelVal[1].startValue){
            level="偏高"
            standard=false;
            noStandardNum++
            return {level,standard};
        }else{
            level="理想"
            standard=true;
            standardNum++;
            return {level,standard};
        }
}
function basalMetabolismJudge(val,levelVal){ //基础代谢
        let level="";
        let standard=false;
        let empty=false;
        val=Math.round(val);
        if(val==0){
            empty=true;
            noData++;
            return {level,empty}
        }
        if(val>=levelVal[1].startValue){
            level="理想"
            standard=true;
            standardNum++;
            return {level,standard};
        }else{
            level="偏低"
            standard=false;
            noStandardNum++;
            return {level,standard};
        }
}
function proteinJudge(val,levelVal){//蛋白质率
        let level="";
        let standard=false;
        let empty=false;
        // val=Math.round(val);
        if(val==0){
            empty=true;
            noData++;
            return {level,empty}
            
        }
        if(val>=levelVal[2].startValue){
            level="偏高"
            standard=false;
            noStandardNum++;
            return {level,standard};
        }else if(val>=levelVal[1].startValue){
            level="标准"
            standard=true;
            standardNum++;
            return {level,standard};
        }else{
            level="偏低"
            standard=false;
            noStandardNum++;
            return {level,standard};
        }
}
function bmiJudge(val){//bmi
        console.log(val);
        let level="";
        let standard=false;
        let empty=false;
        // val=Math.round(val);
        if(val==0){
            empty=true;
            noData++;
            return {level,empty}
        }
        if(val>=28){
            level="肥胖"
            standard=false;
            noStandardNum++;
            return {level,standard};
        }else if(val>=24){
            level="偏胖"
            standard=false;
            noStandardNum++;
            return {level,standard};
        }else if(val>=18.5){
            level="理想"
            standard=true;
            standardNum++;
            return {level,standard};
        }else{
            level="偏瘦"
            standard=false;
            noStandardNum++;
            return {level,standard};
        }
}
function pbfJudge(val,levelVal){//体脂率
        let level="";
        let standard=false;
        let empty=false;
        val=Math.round(val);
        if(val==0){
            empty=true;
            noData++;
            return {level,empty}
        }
        if(val>=levelVal[3].startValue){
            level="超高"
            standard=false;
            noStandardNum++;
            return {level,standard};
        }else if(val>=levelVal[2].startValue){
            level="偏高"
            standard=false;
            noStandardNum++;
            return {level,standard};
        }else if(val>=levelVal[1].startValue){
            level="理想"
            standard=true;
            standardNum++;
            return {level,standard};
        }else{
            level="偏低"
            standard=false;
            noStandardNum++;
            return {level,standard};
        }
}
function muscleJudge(val,levelVal){//肌肉率
        let level="";
        let standard=false;
        let empty=false;
        // val=Math.round(val);
        if(val==0){
            empty=true;
            noData++;
            return {level,empty}
        }
        if(val>=levelVal[2].startValue){
            level="理想"
            standard=true;
            standardNum++;
            return {level,standard};
        }else if(val>=levelVal[1].startValue){
            level="标准"
            standard=true;
            standardNum++;
            return {level,standard};
        }else{
            level="偏低"
            standard=false;
            noStandardNum++;
            return {level,standard};
        }
}
function boneJudge(val,levelVal){//骨重
        let level="";
        let standard=false;
        let empty=false;
        // val=Math.round(val);
        if(val==0){
            empty=true;
            noData++;
            return {level,empty}
        }

        if(val>=levelVal[1].startValue){
            level="理想"
            standard=true;
            standardNum++;
            return {level,standard};
        }else{
            level="偏低"
            standard=false;
            noStandardNum++;
            return {level,standard};
        }
}
function waterJudge(val,levelVal){//水分率
    let level="";
    let standard=false;
        let empty=false;
        val=Math.round(val);
        if(val==0){
            empty=true;
            noData++;
            return {level,empty}
        }
    if(val>=levelVal[2].startValue){
        level="理想"
        standard=true;
        standardNum++;
        return {level,standard};
    }else if(val>=levelVal[1].startValue){
        level="标准"
        standard=true;
        standardNum++;
        return {level,standard};
    }else{
        level="偏低"
        standard=false;
        noStandardNum++;
        return {level,standard};
    }
}  
function ageJudge(age,bodyAge,basalMetabolism){//身体年龄
    let level="";
    let standard=false;
        let empty=false;
        if(basalMetabolism==0){
            empty=true;
            noData++;
            return {level,empty}
        }
    if(age>=bodyAge){
        level="年轻"
        standard=true;
        standardNum++;
        return {level,standard};
    }else{  
        level="偏大"
        standard=false;
        noStandardNum++;
        return {level,standard};
    }
}  
function tznum(){
    return {noStandardNum,standardNum,noData}
}
module.exports={
    resetVal,
    visceralFatJudge,
    basalMetabolismJudge,
    proteinJudge,
    bmiJudge,
    pbfJudge,
    muscleJudge,
    boneJudge,
    waterJudge,
    ageJudge,
    tznum
}